package com.tbq.tbqj_ggl.app

import android.app.Activity
import android.os.Bundle
import android.view.WindowManager
import com.tbq.tbqj_ggl.R

/**
 * Created by hais1992 on 2017/9/1/001.
 */
open class BaseActivity : Activity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        //防止休眠,设置全屏,设置无导航栏
        window.setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
        window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
        overridePendingTransition(R.anim.abc_fade_in, R.anim.abc_fade_out)
    }

    var isDrawFinish = false

    override fun onWindowFocusChanged(hasFocus: Boolean) {
        if (hasFocus && !isDrawFinish) {
            isDrawFinish = true
            onDrawFinish()
        }
    }

    /**
     * 渲染完毕
     */
    open fun onDrawFinish() {

    }
}